package com.lechuang.youleduo1.view.activity.home;

import android.content.Context;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;

import com.lechuang.youleduo1.R;
import com.lechuang.youleduo1.base.BaseActivity;
import com.lechuang.youleduo1.utils.WebViewUtils;
import com.lechuang.youleduo1.view.defineView.ProgressWebView;

public class EmptyWebActivity extends BaseActivity {
    private ProgressWebView mWeb;
    private Context mContext = EmptyWebActivity.this;

    @Override
    protected int getContentView() {
        return R.layout.activity_empty_web;
    }

    @Override
    protected void initTitle() {
        findViewById(R.id.iv_back).setVisibility(View.GONE);
        findViewById(R.id.iv_back2).setVisibility(View.VISIBLE);
    }

    @Override
    protected void initView(Bundle savedInstanceState) {

    }

    @Override
    protected void initData() {
        mWeb = (ProgressWebView) findViewById(R.id.wv_empty);
        WebViewUtils.loadUrl(mWeb, mContext, getIntent().getStringExtra("url"));
    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
        mWeb.destroy();
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK && mWeb.canGoBack()) {
            mWeb.goBack();// 返回前一个页面
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }
}
